﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Index.aspx.cs" Inherits="ValuationClient.Index" %>

<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="copyright" content="All Rights Reserved, Copyright (C) 2013, Wuyeguo, Ltd." />
    <title>地产评估</title>
    <link href="jquery-easyui-1.5.2/themes/default/easyui.css" rel="stylesheet" />
    <link href="jquery-easyui-1.5.2/css/wu.css" rel="stylesheet" />
    <link href="jquery-easyui-1.5.2/css/icon.css" rel="stylesheet" />
    <script src="jquery-easyui-1.5.2/jquery.min.js"></script>
    <script src="jquery-easyui-1.5.2/jquery.easyui.min.js"></script>
    <script src="jquery-easyui-1.5.2/locale/easyui-lang-zh_CN.js"></script>
    <script src="jquery-easyui-1.5.2/easyloader.js"></script>

 
</head>
<body class="easyui-layout">

    <!-- begin of header -->
    <div class="wu-header" data-options="region:'north',border:false,split:true" style="background-color: #a3cdf1">
        <div style="float: left">
            <h1 style="margin-left: 10px;">地产评估系统 V1.0</h1>
        </div>
        <div style="float: right; margin-right: 30px;">
            <h3><strong class="easyui-tooltip"><%=Request["name"] %></strong>，欢迎您！<a href="Login.aspx">退出登录</a></h3>

        </div>
    </div>
    <!-- end of header -->
    <!-- begin of sidebar -->
    <div class="wu-sidebar" data-options="region:'west',split:true,border:true,title:'导航菜单'">
        <div class="easyui-accordion" data-options="border:false,fit:true" id="div3">
            <script>
                $(function () {
                    ARShow();
                    ParentShow();
                })
                //显示父级节点
                function ARShow() {

                    $.ajax({
                        type: "get",
                        url: "http://localhost:55439/api/values/GetAuthorityRole?RoleId=" + <%=Request["rolesId"] %>,
                  async: false,
                  success: function (result) {
                      result = eval(result);
                      var html="";
                      for (var i = 0; i < result.length; i++) {
                          html+="<div title=\""+result[i].authority_Name+"\"  data-options=\"iconCls:'icon-application-cascade'\"   style=\"padding: 5px;\">"
                          html+="<ul class=\"easyui-tree wu-side-tree\" id=\"Parent"+result[i].authority_Id+"\">"
                          html+="</ul>"
                          html+="</div>"
                      }
                      $("#div3").html(html);
                  }
              })
          }
          //显示子级节点
          function ParentShow() {
              $.ajax({
                  type: "get",
                  url: "http://localhost:55439/api/values/GetParentId?RoleId=" + "<%=Request["rolesId"] %>",
                  async: false,
                  success: function (result) {
                      result=eval(result);
                      for (var i = 0; i < result.length; i++) {
                          $("#Parent" + result[i].ParentId + "").append("<li><a  onclick=\"jiazai(this)\"  href=\"javascript:void(0)\" data-link=\""+ result[i].authority_Url+"\" iframe=\"0\">" + result[i].authority_Name + " </a> </li>");
                      }
                  }
              })
          }

            </script>
        </div>
    </div>
    <!-- end of sidebar -->
    <!-- begin of main -->
    <div class="wu-main" data-options="region:'center'">
        <div id="wu-tabs" class="easyui-tabs" data-options="border:false,fit:true">
            <div title="首页" data-link="HomePage.aspx" data-options="href:'HomePage.aspx',closable:false,iconCls:'icon-tip',cls:'pd3'"></div>
        </div>
    </div>
    <!-- end of main -->
    <!-- begin of footer -->
    <div class="wu-footer" data-options="region:'south',border:true,split:true">
        &copy; 2017 Wu All Rights Reserved
    </div>
    <!-- end of footer -->
    <script type="text/javascript">

        function jiazai(obj)
        {
            var title = $(obj).text();
            var url = $(obj).attr('data-link');
            //var iconCls = $(this).attr('data-icon');
            var iframe = $(obj).attr('iframe') == 0 ? true : false;
            addTab(title, url, iframe);
        }


        //$(function () {
        //    $('.wu-side-tree a').bind("click", function () {
        //        var title = $(this).text();
        //        var url = $(this).attr('data-link');
        //        var iconCls = $(this).attr('data-icon');
        //        var iframe = $(this).attr('iframe') == 1 ? true : false;
        //        addTab(title, url, iconCls, iframe);
        //    });
        //})

        /**
		* Name 载入树形菜单 
		*/
        $('#wu-side-tree').tree({
            url: 'temp/menu.php',
            cache: false,
            onClick: function (node) {
                var url = node.attributes['url'];
                if (url == null || url == "") {
                    return false;
                }
                else {
                    addTab(node.text, url, '', node.attributes['iframe']);
                }
            }
        });

        /**
		* Name 选项卡初始化
		*/
        $('#wu-tabs').tabs({
            tools: [{
                iconCls: 'icon-reload',
                border: false,
                handler: function () {
                    $('#wu-datagrid').datagrid('reload');
                }
            }]
        });

        /**
		* Name 添加菜单选项
		* Param title 名称
		* Param href 链接
		* Param iconCls 图标样式
		* Param iframe 链接跳转方式（true为iframe，false为href）
		*/
        function addTab(title, href, iframe) {
            var tabPanel = $('#wu-tabs');
            if (!tabPanel.tabs('exists', title)) {
                var content = '<iframe scrolling="auto" frameborder="0"  src="' + href + '" style="width:100%;height:100%;"></iframe>';
                if (iframe) {
                    tabPanel.tabs('add', {
                        title: title,
                        content: content,
                       // iconCls: iconCls,
                        fit: true,
                        cls: 'pd3',
                        closable: true
                    });
                }
                else {
                    tabPanel.tabs('add', {
                        title: title,
                        href: href,
                        //iconCls: iconCls,
                        fit: true,
                        cls: 'pd3',
                        closable: true
                    });
                }
            }
            else {
                tabPanel.tabs('select', title);
            }
        }
        /**
		* Name 移除菜单选项
		*/
        function removeTab() {
            var tabPanel = $('#wu-tabs');
            var tab = tabPanel.tabs('getSelected');
            if (tab) {
                var index = tabPanel.tabs('getTabIndex', tab);
                tabPanel.tabs('close', index);
            }
        }
    </script>
</body>
</html>

